﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using FeedAntGame.Sprite;
using Microsoft.Xna.Framework.Graphics;

namespace FeedAntGame.Control
{
    class Grid : BaseControl
    {
        public enum TYPE { COLUMN_LINE, ROW_LINE }
        TYPE type;
        int value;
        
        /************************************************************************/
        /*                  GET/SET                                                                     */
        /************************************************************************/
        /// <summary>
        /// should use CheckboxSprite
        /// </summary>
        /// 

        public int Value
        {
            get { return this.value; }
            set { this.value = value; }
        }
        internal override BaseSprite Sprite
        {
            get { return sprite; }
        }
        internal TYPE Type
        {
            get { return type; }
            set 
            { 
                type = value;
                createInstance(sprite.Position);
            }
        }

        
        /************************************************************************/
        /*                  Constructor                                                                     */
        /************************************************************************/
        public Grid(Game game, TYPE type, Vector2 position)
            :base(game)
        {
            this.type = type;
            createInstance(position);
        }

        protected override void createInstance(Vector2 position)
        {
            switch (type)
            {       
                case TYPE.COLUMN_LINE:
                    sprite = new AutomatedSprite(
                        Game.Content.Load<Texture2D>(@"Images\column"), position,
                        new Point(4, 122), 1, Point.Zero, new Point(1,1), Vector2.Zero,null,0,1);
                    sprite.setEdgeScale(1, 1);
                    break;
                case TYPE.ROW_LINE:
                    sprite = new AutomatedSprite(
                        Game.Content.Load<Texture2D>(@"Images\row"), position,
                        new Point(129, 2), 1, Point.Zero, new Point(1, 1), Vector2.Zero, null, 0, 1);
                    sprite.setEdgeScale(1, 1);
                    break;
                    
            }
        }
    }
}
